#include <iostream>
#include <vector>
#include <set>
using namespace std;

int countDistinctWord(string str) {
	
int i,num=1;
	int head=0,tail=0;
	for(tail=0;str[tail] != '\0';tail++){
		if(str[tail] == ' '){

			for(i = head;i <= tail;i++){
				printf("%c",str[i]);
			}
			printf("\n");
			head=tail+1;
			num++;
		}		
	}
	for(i = head;i <= tail;i++){
				printf("%c",str[i]);
			}
			printf("\n");
	return num;
}

int main() {
	string str = "hello hello wwor world! Ni";
	cout << countDistinctWord(str) << endl;

	return 0;
}